package com.sunxd.limit;

import com.google.common.collect.Lists;
import com.sunxd.limit.beans.constants.LimitAnnotationGroup;
import com.sunxd.limit.beans.constants.LimitAnnotationKey;
import com.sunxd.limit.beans.params.ActivityRequest;
import com.sunxd.limit.beans.params.Limit;
import com.sunxd.limit.core.LimitHandlerUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.List;

@SpringBootApplication
public class ZCommonLimitApplication {

    public static void main(String[] args) {
        SpringApplication.run(ZCommonLimitApplication.class, args);
        ActivityRequest request =  new ActivityRequest();
        request.setCurrentCity("320100");
        request.setGroup("group1");
        request.setSuitObject("suitObject1");
        request.setType("type");
        List<Limit> limitList = Lists.newArrayList();
        limitList.add(Limit.builder().isOpen(Boolean.TRUE).key(LimitAnnotationKey.CITY_LIMIT).value(Lists.newArrayList("320100","330100")).build());
        limitList.add(Limit.builder().isOpen(Boolean.TRUE).key(LimitAnnotationKey.GROUP_LIMIT).value(Lists.newArrayList("group1","group2")).build());
        limitList.add(Limit.builder().isOpen(Boolean.TRUE).key(LimitAnnotationKey.SUIT_OBJECT_LIMIT).value("suitObject").build());
        limitList.add(Limit.builder().isOpen(Boolean.TRUE).key(LimitAnnotationKey.TYPE_LIMIT).value("type").build());

        Boolean judge = LimitHandlerUtil.judge(LimitAnnotationGroup.ACTIVITY, limitList, request);
        System.out.println(judge);

    }

}
